package com.ceair.flight.refund.location.dt.enums;

/**
 * 旅客类型枚举
 *
 * @author rujun
 *
 */
public enum PaxTypeEnum {

    ADULT("ADT", 1, "成人"),
    CHILD("CHD", 2, "儿童"),
    INFANT("INF", 3, "婴儿"),
    CHILD_LESSTHAN_5("CHD_LTHAN_5",4,"未满5周岁儿童"),
    ADULT_LESSTHAN_18("ADT_LTHAN_18",5,"未满18周岁成人");

    /**
     * 简码
     */
    private final String code;

    /**
     * 描述
     */
    private final String description;

    private final int numValue;

    private PaxTypeEnum(String code, int numValue, String description) {
        this.code = code;
        this.numValue = numValue;
        this.description = description;
    }

    /**
     * @return Returns the code.
     */
    public String getCode() {
        return code;
    }

    public int getNumValue() {
        return numValue;
    }

    /**
     * @return Returns the description.
     */
    public String getDescription() {
        return description;
    }

    /**
     * 通过枚举<code>code</code>获得枚举。
     *
     * @param code 简码
     * @return 枚举
     */
    public static com.ceair.flight.refund.location.dt.enums.PaxTypeEnum getByCode(String code) {
        for (com.ceair.flight.refund.location.dt.enums.PaxTypeEnum status : values()) {
            if (status.getCode().equalsIgnoreCase(code)) {
                return status;
            }
        }
        return null;
    }

    /**
     * 通过枚举<code>code</code>获得枚举。
     *
     * @param code 简码
     * @return 枚举
     */
    public static com.ceair.flight.refund.location.dt.enums.PaxTypeEnum getByNumber(int num) {
        for (com.ceair.flight.refund.location.dt.enums.PaxTypeEnum status : values()) {
            if (status.getNumValue() == num) {
                return status;
            }
        }
        return null;
    }
    public static String textValue(String code) {
        com.ceair.flight.refund.location.dt.enums.PaxTypeEnum type = getByCode(code);
        return textValue(type);
    }

    public static String textValue(com.ceair.flight.refund.location.dt.enums.PaxTypeEnum type) {
        if (CHILD == type) {
            return "Child";
        } else if (INFANT == type) {
            return "Infant";
        }
        return "Adult";
    }
}
